package com.novax.ex.activity.open.api;

import com.novax.ex.activity.open.model.query.MallPrizeOrderQuery;
import com.novax.ex.activity.open.model.request.MallPrizeOrderRequest;
import com.novax.ex.activity.open.model.response.MallPrizeOrderResponse;
import com.novax.ex.common.results.ReturnResult;
import com.novax.ex.common.util.PageUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @Description 一元购订单api
 * @Author zhaolei
 * @Date 2/22/23 11:41 AM
 * @Version 1.0
 */
@Tag(name = "一元购-前台展示-用户订单", description = "一元购-用户订单信息")
@FeignClient(url = "${remote.activity-service.endpoint}", name = "MallPrizeOrderApi", contextId = "MallPrizeOrderApi")
@RequestMapping("/v3/mall/order")
public interface MallPrizeOrderApi {
    // 钱包历史里面访问的接口 spot/finance/records
    @Operation(summary = "购买")
    @PostMapping
    ReturnResult<?> buy(@RequestHeader("userId") Long userId,
                        @RequestHeader("language") String language,
                        @RequestBody MallPrizeOrderRequest orderRequest);

    @Operation(summary = "查询现货余额")
    @GetMapping(value = "/asset")
    ReturnResult<BigDecimal> asset(@RequestHeader("userId") Long userId,
                                   @RequestHeader("language") String language,
                                   @RequestParam("currency") String currency);

    @Operation(summary = "查询购买记录")
    @GetMapping(value = "/list")
    ReturnResult<PageUtil<MallPrizeOrderResponse>> list(@RequestHeader("userId") Long userId,
                                                        @RequestHeader("language") String language,
                                                        @ParameterObject MallPrizeOrderQuery query);

    @Operation(summary = "查询是否存在待领取")
    @GetMapping(value = "/unclaimed")
    ReturnResult<MallPrizeOrderResponse> unclaimed(@RequestHeader("userId") Long userId,
                                                   @RequestHeader("language") String language);

    @Operation(summary = "查询最新一条已发放记录")
    @GetMapping(value = "/getWinnerNew")
    ReturnResult<MallPrizeOrderResponse> getWinnerNew(@RequestHeader("userId") Long userId,
                                                @RequestHeader("language") String language);

    @Operation(summary = "设置中奖记录已发放为已读")
    @PostMapping(value = "/setWinnerNewTag")
    ReturnResult<?> setWinnerNewTag(@RequestHeader("userId") Long userId,
                              @RequestHeader("language") String language,
                              @RequestParam("id") Long id);
}
